package test;

public class 线程限期等待 {
    public static class Main {
        public static void main(String[] args) {
            // 创建一个线程，让它处于限期等待状态
            Thread thread1 = new Thread(() -> {
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            });

            // 创建一个线程，让它打印一条消息
            Thread thread2 = new Thread(() -> System.out.println("Hello, world!"));

            // 启动线程
            thread1.start();
            thread2.start();
        }
    }
}
